# encoding: utf-8
""" 
@version: v1.0 
@author: autumner 
@license: Apache Licence  
@contact: 18322313385@163.com 
@site:  https://gitee.com/autumner/pythoncookbook
@software: PyCharm 
@file: net_tcp_Client_1.py 
@time: 2019/7/11 上午10:33
"""
'''
创建tcp的客户端

'''

from socket import socket, AF_INET, SOCK_STREAM

s = socket(AF_INET, SOCK_STREAM)
s.connect(('localhost', 20000))
s.send(b'hello')
print(s.recv(8192))
for i in range(10):
    s.send(b'hello world! the same to you')
    print(s.recv(8192))
s.close()